<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * some key-codes definition and utils from closure-library
 * @author yiminghe@gmail.com
 */
KISSY.add('event/dom/base/key-codes', function (S) {
    var UA = S.UA,
<span id='KISSY-Event-DomEvent-KeyCode'>        /**
</span>         * @enum {Number} KISSY.Event.DomEvent.KeyCode
         * @alias KISSY.Event.KeyCode
         * All key codes.
         */
            KeyCode = {
<span id='KISSY-Event-DomEvent-KeyCode-property-MAC_ENTER'>            /**
</span>             * MAC_ENTER
             */
            MAC_ENTER: 3,
<span id='KISSY-Event-DomEvent-KeyCode-property-BACKSPACE'>            /**
</span>             * BACKSPACE
             */
            BACKSPACE: 8,
<span id='KISSY-Event-DomEvent-KeyCode-property-TAB'>            /**
</span>             * TAB
             */
            TAB: 9,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_CENTER'>            /**
</span>             * NUMLOCK on FF/Safari Mac
             */
            NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac
<span id='KISSY-Event-DomEvent-KeyCode-property-ENTER'>            /**
</span>             * ENTER
             */
            ENTER: 13,
<span id='KISSY-Event-DomEvent-KeyCode-property-SHIFT'>            /**
</span>             * SHIFT
             */
            SHIFT: 16,
<span id='KISSY-Event-DomEvent-KeyCode-property-CTRL'>            /**
</span>             * CTRL
             */
            CTRL: 17,
<span id='KISSY-Event-DomEvent-KeyCode-property-ALT'>            /**
</span>             * ALT
             */
            ALT: 18,
<span id='KISSY-Event-DomEvent-KeyCode-property-PAUSE'>            /**
</span>             * PAUSE
             */
            PAUSE: 19,
<span id='KISSY-Event-DomEvent-KeyCode-property-CAPS_LOCK'>            /**
</span>             * CAPS_LOCK
             */
            CAPS_LOCK: 20,
<span id='KISSY-Event-DomEvent-KeyCode-property-ESC'>            /**
</span>             * ESC
             */
            ESC: 27,
<span id='KISSY-Event-DomEvent-KeyCode-property-SPACE'>            /**
</span>             * SPACE
             */
            SPACE: 32,
<span id='KISSY-Event-DomEvent-KeyCode-property-PAGE_UP'>            /**
</span>             * PAGE_UP
             */
            PAGE_UP: 33, // also NUM_NORTH_EAST
<span id='KISSY-Event-DomEvent-KeyCode-property-PAGE_DOWN'>            /**
</span>             * PAGE_DOWN
             */
            PAGE_DOWN: 34, // also NUM_SOUTH_EAST
<span id='KISSY-Event-DomEvent-KeyCode-property-END'>            /**
</span>             * END
             */
            END: 35, // also NUM_SOUTH_WEST
<span id='KISSY-Event-DomEvent-KeyCode-property-HOME'>            /**
</span>             * HOME
             */
            HOME: 36, // also NUM_NORTH_WEST
<span id='KISSY-Event-DomEvent-KeyCode-property-LEFT'>            /**
</span>             * LEFT
             */
            LEFT: 37, // also NUM_WEST
<span id='KISSY-Event-DomEvent-KeyCode-property-UP'>            /**
</span>             * UP
             */
            UP: 38, // also NUM_NORTH
<span id='KISSY-Event-DomEvent-KeyCode-property-RIGHT'>            /**
</span>             * RIGHT
             */
            RIGHT: 39, // also NUM_EAST
<span id='KISSY-Event-DomEvent-KeyCode-property-DOWN'>            /**
</span>             * DOWN
             */
            DOWN: 40, // also NUM_SOUTH
<span id='KISSY-Event-DomEvent-KeyCode-property-PRINT_SCREEN'>            /**
</span>             * PRINT_SCREEN
             */
            PRINT_SCREEN: 44,
<span id='KISSY-Event-DomEvent-KeyCode-property-INSERT'>            /**
</span>             * INSERT
             */
            INSERT: 45, // also NUM_INSERT
<span id='KISSY-Event-DomEvent-KeyCode-property-DELETE'>            /**
</span>             * DELETE
             */
            DELETE: 46, // also NUM_DELETE
<span id='KISSY-Event-DomEvent-KeyCode-property-ZERO'>            /**
</span>             * ZERO
             */
            ZERO: 48,
<span id='KISSY-Event-DomEvent-KeyCode-property-ONE'>            /**
</span>             * ONE
             */
            ONE: 49,
<span id='KISSY-Event-DomEvent-KeyCode-property-TWO'>            /**
</span>             * TWO
             */
            TWO: 50,
<span id='KISSY-Event-DomEvent-KeyCode-property-THREE'>            /**
</span>             * THREE
             */
            THREE: 51,
<span id='KISSY-Event-DomEvent-KeyCode-property-FOUR'>            /**
</span>             * FOUR
             */
            FOUR: 52,
<span id='KISSY-Event-DomEvent-KeyCode-property-FIVE'>            /**
</span>             * FIVE
             */
            FIVE: 53,
<span id='KISSY-Event-DomEvent-KeyCode-property-SIX'>            /**
</span>             * SIX
             */
            SIX: 54,
<span id='KISSY-Event-DomEvent-KeyCode-property-SEVEN'>            /**
</span>             * SEVEN
             */
            SEVEN: 55,
<span id='KISSY-Event-DomEvent-KeyCode-property-EIGHT'>            /**
</span>             * EIGHT
             */
            EIGHT: 56,
<span id='KISSY-Event-DomEvent-KeyCode-property-NINE'>            /**
</span>             * NINE
             */
            NINE: 57,
<span id='KISSY-Event-DomEvent-KeyCode-property-QUESTION_MARK'>            /**
</span>             * QUESTION_MARK
             */
            QUESTION_MARK: 63, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-A'>            /**
</span>             * A
             */
            A: 65,
<span id='KISSY-Event-DomEvent-KeyCode-property-B'>            /**
</span>             * B
             */
            B: 66,
<span id='KISSY-Event-DomEvent-KeyCode-property-C'>            /**
</span>             * C
             */
            C: 67,
<span id='KISSY-Event-DomEvent-KeyCode-property-D'>            /**
</span>             * D
             */
            D: 68,
<span id='KISSY-Event-DomEvent-KeyCode-property-E'>            /**
</span>             * E
             */
            E: 69,
<span id='KISSY-Event-DomEvent-KeyCode-property-F'>            /**
</span>             * F
             */
            F: 70,
<span id='KISSY-Event-DomEvent-KeyCode-property-G'>            /**
</span>             * G
             */
            G: 71,
<span id='KISSY-Event-DomEvent-KeyCode-property-H'>            /**
</span>             * H
             */
            H: 72,
<span id='KISSY-Event-DomEvent-KeyCode-property-I'>            /**
</span>             * I
             */
            I: 73,
<span id='KISSY-Event-DomEvent-KeyCode-property-J'>            /**
</span>             * J
             */
            J: 74,
<span id='KISSY-Event-DomEvent-KeyCode-property-K'>            /**
</span>             * K
             */
            K: 75,
<span id='KISSY-Event-DomEvent-KeyCode-property-L'>            /**
</span>             * L
             */
            L: 76,
<span id='KISSY-Event-DomEvent-KeyCode-property-M'>            /**
</span>             * M
             */
            M: 77,
<span id='KISSY-Event-DomEvent-KeyCode-property-N'>            /**
</span>             * N
             */
            N: 78,
<span id='KISSY-Event-DomEvent-KeyCode-property-O'>            /**
</span>             * O
             */
            O: 79,
<span id='KISSY-Event-DomEvent-KeyCode-property-P'>            /**
</span>             * P
             */
            P: 80,
<span id='KISSY-Event-DomEvent-KeyCode-property-Q'>            /**
</span>             * Q
             */
            Q: 81,
<span id='KISSY-Event-DomEvent-KeyCode-property-R'>            /**
</span>             * R
             */
            R: 82,
<span id='KISSY-Event-DomEvent-KeyCode-property-S'>            /**
</span>             * S
             */
            S: 83,
<span id='KISSY-Event-DomEvent-KeyCode-property-T'>            /**
</span>             * T
             */
            T: 84,
<span id='KISSY-Event-DomEvent-KeyCode-property-U'>            /**
</span>             * U
             */
            U: 85,
<span id='KISSY-Event-DomEvent-KeyCode-property-V'>            /**
</span>             * V
             */
            V: 86,
<span id='KISSY-Event-DomEvent-KeyCode-property-W'>            /**
</span>             * W
             */
            W: 87,
<span id='KISSY-Event-DomEvent-KeyCode-property-X'>            /**
</span>             * X
             */
            X: 88,
<span id='KISSY-Event-DomEvent-KeyCode-property-Y'>            /**
</span>             * Y
             */
            Y: 89,
<span id='KISSY-Event-DomEvent-KeyCode-property-Z'>            /**
</span>             * Z
             */
            Z: 90,
<span id='KISSY-Event-DomEvent-KeyCode-property-META'>            /**
</span>             * META
             */
            META: 91, // WIN_KEY_LEFT
<span id='KISSY-Event-DomEvent-KeyCode-property-WIN_KEY_RIGHT'>            /**
</span>             * WIN_KEY_RIGHT
             */
            WIN_KEY_RIGHT: 92,
<span id='KISSY-Event-DomEvent-KeyCode-property-CONTEXT_MENU'>            /**
</span>             * CONTEXT_MENU
             */
            CONTEXT_MENU: 93,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_ZERO'>            /**
</span>             * NUM_ZERO
             */
            NUM_ZERO: 96,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_ONE'>            /**
</span>             * NUM_ONE
             */
            NUM_ONE: 97,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_TWO'>            /**
</span>             * NUM_TWO
             */
            NUM_TWO: 98,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_THREE'>            /**
</span>             * NUM_THREE
             */
            NUM_THREE: 99,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_FOUR'>            /**
</span>             * NUM_FOUR
             */
            NUM_FOUR: 100,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_FIVE'>            /**
</span>             * NUM_FIVE
             */
            NUM_FIVE: 101,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_SIX'>            /**
</span>             * NUM_SIX
             */
            NUM_SIX: 102,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_SEVEN'>            /**
</span>             * NUM_SEVEN
             */
            NUM_SEVEN: 103,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_EIGHT'>            /**
</span>             * NUM_EIGHT
             */
            NUM_EIGHT: 104,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_NINE'>            /**
</span>             * NUM_NINE
             */
            NUM_NINE: 105,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_MULTIPLY'>            /**
</span>             * NUM_MULTIPLY
             */
            NUM_MULTIPLY: 106,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_PLUS'>            /**
</span>             * NUM_PLUS
             */
            NUM_PLUS: 107,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_MINUS'>            /**
</span>             * NUM_MINUS
             */
            NUM_MINUS: 109,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_PERIOD'>            /**
</span>             * NUM_PERIOD
             */
            NUM_PERIOD: 110,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUM_DIVISION'>            /**
</span>             * NUM_DIVISION
             */
            NUM_DIVISION: 111,
<span id='KISSY-Event-DomEvent-KeyCode-property-F1'>            /**
</span>             * F1
             */
            F1: 112,
<span id='KISSY-Event-DomEvent-KeyCode-property-F2'>            /**
</span>             * F2
             */
            F2: 113,
<span id='KISSY-Event-DomEvent-KeyCode-property-F3'>            /**
</span>             * F3
             */
            F3: 114,
<span id='KISSY-Event-DomEvent-KeyCode-property-F4'>            /**
</span>             * F4
             */
            F4: 115,
<span id='KISSY-Event-DomEvent-KeyCode-property-F5'>            /**
</span>             * F5
             */
            F5: 116,
<span id='KISSY-Event-DomEvent-KeyCode-property-F6'>            /**
</span>             * F6
             */
            F6: 117,
<span id='KISSY-Event-DomEvent-KeyCode-property-F7'>            /**
</span>             * F7
             */
            F7: 118,
<span id='KISSY-Event-DomEvent-KeyCode-property-F8'>            /**
</span>             * F8
             */
            F8: 119,
<span id='KISSY-Event-DomEvent-KeyCode-property-F9'>            /**
</span>             * F9
             */
            F9: 120,
<span id='KISSY-Event-DomEvent-KeyCode-property-F10'>            /**
</span>             * F10
             */
            F10: 121,
<span id='KISSY-Event-DomEvent-KeyCode-property-F11'>            /**
</span>             * F11
             */
            F11: 122,
<span id='KISSY-Event-DomEvent-KeyCode-property-F12'>            /**
</span>             * F12
             */
            F12: 123,
<span id='KISSY-Event-DomEvent-KeyCode-property-NUMLOCK'>            /**
</span>             * NUMLOCK
             */
            NUMLOCK: 144,
<span id='KISSY-Event-DomEvent-KeyCode-property-SEMICOLON'>            /**
</span>             * SEMICOLON
             */
            SEMICOLON: 186, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-DASH'>            /**
</span>             * DASH
             */
            DASH: 189, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-EQUALS'>            /**
</span>             * EQUALS
             */
            EQUALS: 187, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-COMMA'>            /**
</span>             * COMMA
             */
            COMMA: 188, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-PERIOD'>            /**
</span>             * PERIOD
             */
            PERIOD: 190, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-SLASH'>            /**
</span>             * SLASH
             */
            SLASH: 191, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-APOSTROPHE'>            /**
</span>             * APOSTROPHE
             */
            APOSTROPHE: 192, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-SINGLE_QUOTE'>            /**
</span>             * SINGLE_QUOTE
             */
            SINGLE_QUOTE: 222, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-OPEN_SQUARE_BRACKET'>            /**
</span>             * OPEN_SQUARE_BRACKET
             */
            OPEN_SQUARE_BRACKET: 219, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-BACKSLASH'>            /**
</span>             * BACKSLASH
             */
            BACKSLASH: 220, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-CLOSE_SQUARE_BRACKET'>            /**
</span>             * CLOSE_SQUARE_BRACKET
             */
            CLOSE_SQUARE_BRACKET: 221, // needs localization
<span id='KISSY-Event-DomEvent-KeyCode-property-WIN_KEY'>            /**
</span>             * WIN_KEY
             */
            WIN_KEY: 224,
<span id='KISSY-Event-DomEvent-KeyCode-property-MAC_FF_META'>            /**
</span>             * MAC_FF_META
             */
            MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91
<span id='KISSY-Event-DomEvent-KeyCode-property-WIN_IME'>            /**
</span>             * WIN_IME
             */
            WIN_IME: 229
        };

    /*
      whether text and modified key is entered at the same time.
     */
    KeyCode.isTextModifyingKeyEvent = function (e) {
        var keyCode = e.keyCode;
        if (e.altKey &amp;&amp; !e.ctrlKey || e.metaKey ||
            // Function keys don't generate text
            keyCode &gt;= KeyCode.F1 &amp;&amp; keyCode &lt;= KeyCode.F12) {
            return false;
        }

        // The following keys are quite harmless, even in combination with
        // CTRL, ALT or SHIFT.
        switch (keyCode) {
            case KeyCode.ALT:
            case KeyCode.CAPS_LOCK:
            case KeyCode.CONTEXT_MENU:
            case KeyCode.CTRL:
            case KeyCode.DOWN:
            case KeyCode.END:
            case KeyCode.ESC:
            case KeyCode.HOME:
            case KeyCode.INSERT:
            case KeyCode.LEFT:
            case KeyCode.MAC_FF_META:
            case KeyCode.META:
            case KeyCode.NUMLOCK:
            case KeyCode.NUM_CENTER:
            case KeyCode.PAGE_DOWN:
            case KeyCode.PAGE_UP:
            case KeyCode.PAUSE:
            case KeyCode.PRINT_SCREEN:
            case KeyCode.RIGHT:
            case KeyCode.SHIFT:
            case KeyCode.UP:
            case KeyCode.WIN_KEY:
            case KeyCode.WIN_KEY_RIGHT:
                return false;
            default:
                return true;
        }
    };

    /*
      whether character is entered.
     */
    KeyCode.isCharacterKey = function (keyCode) {
        if (keyCode &gt;= KeyCode.ZERO &amp;&amp;
            keyCode &lt;= KeyCode.NINE) {
            return true;
        }

        if (keyCode &gt;= KeyCode.NUM_ZERO &amp;&amp;
            keyCode &lt;= KeyCode.NUM_MULTIPLY) {
            return true;
        }

        if (keyCode &gt;= KeyCode.A &amp;&amp;
            keyCode &lt;= KeyCode.Z) {
            return true;
        }

        // Safari sends zero key code for non-latin characters.
        if (UA.webkit &amp;&amp; keyCode == 0) {
            return true;
        }

        switch (keyCode) {
            case KeyCode.SPACE:
            case KeyCode.QUESTION_MARK:
            case KeyCode.NUM_PLUS:
            case KeyCode.NUM_MINUS:
            case KeyCode.NUM_PERIOD:
            case KeyCode.NUM_DIVISION:
            case KeyCode.SEMICOLON:
            case KeyCode.DASH:
            case KeyCode.EQUALS:
            case KeyCode.COMMA:
            case KeyCode.PERIOD:
            case KeyCode.SLASH:
            case KeyCode.APOSTROPHE:
            case KeyCode.SINGLE_QUOTE:
            case KeyCode.OPEN_SQUARE_BRACKET:
            case KeyCode.BACKSLASH:
            case KeyCode.CLOSE_SQUARE_BRACKET:
                return true;
            default:
                return false;
        }
    };

    return KeyCode;
});</pre>
</body>
</html>
